package com.heima.apis.schedule;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "leadnews-schedule")
public interface TaskFeignClient {

    /**
     * 添加定时任务
     * @param task
     * @return
     */
    @PostMapping("/ap1/v1/task/add")
    public ResponseResult addTask(@RequestBody Task task);


    /**
     * 取消定时任务
     * @param taskId
     * @return
     */
    @DeleteMapping("/ap1/v1/task/{taskId}")
    public ResponseResult cancelTask(@PathVariable("taskId") Long taskId);

    /**
     * 消费定时任务
     * @param taskType
     * @param priority
     * @return
     */
    @GetMapping("/ap1/v1/task//poll/{taskType}/{priority}")
    public ResponseResult<Task> consumerTask(@PathVariable("taskType") Integer taskType,
                                       @PathVariable("priority") Integer priority);
}

